﻿#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;

namespace VRChatAvatarToolkit {
    public class MoyuToolkit : MoyuToolkitUtils {
        private const string version = "v1.1.0";
        // 主菜单
        [MenuItem("VRC工具箱/VRC SDK 2转3", false, 0)]
        static void ShowWindow_FixAvatarToSdk3()
        {
            GetWindow(typeof(FixAvatarToSdk3));
        }

        [MenuItem("VRC工具箱/一键穿衣", false, 1)]
        static void ShowWindow_QuickDressed()
        {
            GetWindow(typeof(QuickDressed));
        }
        [MenuItem("VRC工具箱/动作播放器", false, 2)]
        static void ShowWindow_AnimationPlayer()
        {
            GetWindow(typeof(AvatarAnimationPlayer));
        }
        [MenuItem("VRC工具箱/我的衣柜", false, 3)]
        static void ShowWindow_AvatarWardrobe()
        {
            GetWindow(typeof(AvatarWardrobeEdirtor));
        }
        [MenuItem("VRC工具箱/By: 如梦/使用教程", false, 50)]
        static void ShowWindow_GotoGiteeReadme()
        {
            Application.OpenURL("https://gitee.com/cmoyuer/vrchat-avatar-toolkit/blob/master/README.md");
        }
        [MenuItem("VRC工具箱/By: 如梦/打开Gitee仓库", false, 52)]
        static void ShowWindow_GotoGitee()
        {
            Application.OpenURL("https://gitee.com/cmoyuer/vrchat-avatar-toolkit");
        }
        [MenuItem("VRC工具箱/By: 如梦/版本" + version + "（点击查看更新)", false, 53)]
        static void ShowWindow_GotoGiteeReleases()
        {
            Application.OpenURL("https://gitee.com/cmoyuer/vrchat-avatar-toolkit/releases/");
        }
        // 脚本菜单
        [MenuItem("CONTEXT/VRC_AvatarDescriptor/升级为SDK3")]
        static void Fix_AvatarToSdk3(MenuCommand cmd)
        {
            var avatar = GetGameObjectFormMenuCommand(cmd);
            FixAvatarToSdk3.FixModel(avatar);
        }

        // 工具
        static GameObject GetGameObjectFormMenuCommand(MenuCommand cmd)
        {
            var component = cmd.context as Component;
            return component.gameObject;
        }
    }
}
#endif